home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / sprite.X11R3 / spriteddx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-19  |  8.0 KB  |  222 lines

  1. /*-
  2.  * sprite.h --
  3.  *    Internal declarations for the sprite ddx interface
  4.  *
  5.  * Copyright (c) 1987 by the Regents of the University of California
  6.  *
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  *    "$Header: /mic/X11R3/src/cmds/Xsp/ddx/sprite/RCS/spriteddx.h,v 1.7 89/11/18 20:57:32 tve Exp $ SPRITE (Berkeley)"
  16.  */
  17. #ifndef _SPRITEDDX_H_
  18. #define _SPRITEDDX_H_
  19.  
  20. #define Time      SpriteTime
  21.  
  22. #include    <sprite.h>
  23. #include    <kernel/devVid.h>
  24. #include    <dev/mouse.h>
  25. #include    <vm.h>
  26.  
  27. #undef Time
  28.  
  29. #include    "X.h"
  30. #include    "Xproto.h"
  31. #include    "scrnintstr.h"
  32. #include    "screenint.h"
  33. #ifdef NEED_EVENTS
  34. #include    "inputstr.h"
  35. #endif NEED_EVENTS
  36. #include    "input.h"
  37. #include    "cursorstr.h"
  38. #include    "cursor.h"
  39. #include    "pixmapstr.h"
  40. #include    "pixmap.h"
  41. #include    "gc.h"
  42. #include    "gcstruct.h"
  43. #include    "region.h"
  44. #include    "colormap.h"
  45. #include    "miscstruct.h"
  46. #include    "dix.h"
  47. #include    "mfb.h"
  48. #include    "mi.h"
  49.  
  50. /*
  51.  * MAXEVENTS is the maximum number of events the mouse and keyboard functions
  52.  * will read on a given call to their GetEvents vectors.
  53.  */
  54. #define MAXEVENTS     32
  55.  
  56. /*
  57.  * Data private to any sprite keyboard.
  58.  *    GetEvents reads any events which are available for the keyboard
  59.  *    ProcessEvent processes a single event and gives it to DIX
  60.  *    DoneEvents is called when done handling a string of keyboard
  61.  *        events or done handling all events.
  62.  *    devPrivate is private to the specific keyboard.
  63.  *    map_q is TRUE if the event queue for the keyboard is memory mapped.
  64.  */
  65. typedef struct kbPrivate {
  66.     int              type;               /* Type of keyboard */
  67.     int              fd;                    /* Descriptor open to device */
  68.     Mouse_Event   *(*GetEvents)();      /* Function to read events */
  69.     void          (*ProcessEvent)();    /* Function to process an event */
  70.     void          (*DoneEvents)();      /* Function called when all events */
  71.                     /* have been handled. */
  72.     int              offset;               /* Offset for keyboard codes */
  73.     KeybdCtrl      *ctrl;                /* Current control info */
  74.     pointer       devPrivate;            /* Private to keyboard device */
  75. } KbPrivRec, *KbPrivPtr;
  76.  
  77. /*
  78.  * Data private to any sprite pointer device.
  79.  *    GetEvents, ProcessEvent and DoneEvents have uses similar to the
  80.  *        keyboard fields of the same name.
  81.  *    pScreen is the screen the pointer is on (only valid if it is the
  82.  *        main pointer device).
  83.  *    x and y are absolute coordinates on that screen (they may be negative)
  84.  */
  85. typedef struct ptrPrivate {
  86.     int              fd;                    /* Descriptor to device */
  87.     Mouse_Event   *(*GetEvents)();     /* Function to read events */
  88.     void          (*ProcessEvent)();    /* Function to process an event */
  89.     void          (*DoneEvents)();      /* When all the events have been */
  90.                     /* handled, this function will be */
  91.                     /* called. */
  92.     short         x,                    /* Current X coordinate of pointer */
  93.           y;                    /* Current Y coordinate */
  94.     ScreenPtr      pScreen;              /* Screen pointer is on */
  95.     pointer          devPrivate;            /* Field private to device */
  96. } PtrPrivRec, *PtrPrivPtr;
  97.  
  98. /*
  99.  * Cursor-private data
  100.  *    screenBits    saves the contents of the screen before the cursor
  101.  *                  was placed in the frame buffer.
  102.  *    source          a bitmap for placing the foreground pixels down
  103.  *    srcGC          a GC for placing the foreground pixels down.
  104.  *                  Prevalidated for the cursor's screen.
  105.  *    invSource     a bitmap for placing the background pixels down.
  106.  *    invSrcGC      a GC for placing the background pixels down.
  107.  *                  Also prevalidated for the cursor's screen Pixmap.
  108.  *    temp          a temporary pixmap for low-flicker cursor motion --
  109.  *                  exists to avoid the overhead of creating a pixmap
  110.  *                  whenever the cursor must be moved.
  111.  *    fg, bg          foreground and background pixels. For a color display,
  112.  *                  these are allocated once and the rgb values changed
  113.  *                  when the cursor is recolored.
  114.  *    scrX, scrY    the coordinate on the screen of the upper-left corner
  115.  *                  of screenBits.
  116.  *    state          one of CR_IN, CR_OUT and CR_XING to track whether the
  117.  *                  cursor is in or out of the frame buffer or is in the
  118.  *                  process of going from one state to the other.
  119.  */
  120. typedef enum {
  121.     CR_IN,        /* Cursor in frame buffer */
  122.     CR_OUT,        /* Cursor out of frame buffer */
  123.     CR_XING          /* Cursor in flux */
  124. } CrState;
  125.  
  126. typedef struct crPrivate {
  127.     PixmapPtr              screenBits; /* Screen before cursor put down */
  128.     PixmapPtr              source;     /* Cursor source (foreground bits) */
  129.     GCPtr             srcGC;        /* Foreground GC */
  130.     PixmapPtr              invSource;  /* Cursor source inverted (background) */
  131.     GCPtr             invSrcGC;   /* Background GC */
  132.     PixmapPtr              temp;        /* Temporary pixmap for merging screenBits
  133.                      * and the sources. Saves creation time */
  134.     Pixel             fg;         /* Foreground color */
  135.     Pixel             bg;         /* Background color */
  136.     int                  scrX,        /* Screen X coordinate of screenBits */
  137.             scrY;        /* Screen Y coordinate of screenBits */
  138.     CrState        state;      /* Current state of the cursor */
  139. } CrPrivRec, *CrPrivPtr;
  140.  
  141. /*
  142.  * Frame-buffer-private info.
  143.  *    fb            pointer to the mapped image of the frame buffer. Used
  144.  *                  by the driving routines for the specific frame buffer
  145.  *                  type.
  146.  *    cmap        pointer to the mapped colormap of tha frame buffer.
  147.  *            Used by the driving routines for the specific frame
  148.  *                  buffer type.
  149.  *    pGC           A graphics context to be used by the cursor functions
  150.  *                  when drawing the cursor on the screen.
  151.  *    GetImage      Original GetImage function for this screen.
  152.  *    CreateGC      Original CreateGC function
  153.  *    CreateWindow    Original CreateWindow function
  154.  *    ChangeWindowAttributes    Original function
  155.  *    GetSpans      GC function which needs to be here b/c GetSpans isn't
  156.  *                  called with the GC as an argument...
  157.  *    mapped          flag set true by the driver when the frame buffer has
  158.  *                  been mapped in.
  159.  */
  160. typedef struct {
  161.     pointer           fb;         /* Frame buffer itself */
  162.     pointer           cmap;         /* Color map */
  163.     GCPtr             pGC;        /* GC for cursor operations */
  164.  
  165.     void              (*GetImage)();
  166.     Bool              (*CreateGC)();/* GC Creation function previously in the
  167.                        * Screen structure */
  168.     Bool              (*CreateWindow)();
  169.     Bool        (*ChangeWindowAttributes)();
  170.     unsigned int      *(*GetSpans)(); /* XXX: Shouldn't need this */
  171.     
  172.     Bool              mapped;        /* TRUE if frame buffer already mapped */
  173. } fbFd;
  174.  
  175. /*
  176.  * Cursor functions in spriteCursor.c
  177.  */
  178. extern void       spriteInitCursor();
  179. extern Bool       spriteRealizeCursor();
  180. extern Bool       spriteUnrealizeCursor();
  181. extern Bool       spriteDisplayCursor();
  182. extern Bool       spriteSetCursorPosition();
  183. extern void       spriteCursorLimits();
  184. extern void       spritePointerNonInterestBox();
  185. extern void       spriteConstrainCursor();
  186. extern void       spriteRecolorCursor();
  187. extern Bool      spriteCursorLoc();
  188. extern void       spriteRemoveCursor();
  189. extern void      spriteRestoreCursor();
  190. extern void       spriteMoveCursor();
  191.  
  192. /*
  193.  * Initialization
  194.  */
  195. extern void       spriteScreenInit();
  196.  
  197. /*
  198.  * GC Interceptions in spriteGC.c and spriteCursor.c
  199.  */
  200. extern GCPtr      spriteCreatePrivGC();
  201. extern Bool      spriteCreateGC();
  202. extern Bool      spriteCreateWindow();
  203. extern Bool      spriteChangeWindowAttributes();
  204.  
  205. extern void       spriteGetImage();
  206. extern unsigned int *spriteGetSpans();
  207.  
  208. extern fbFd       spriteFbs[];
  209.  
  210. extern unsigned int lastEventTime;    /* Time (in real ms.) of last event */
  211. extern unsigned int lastEventTimeMS;  /* Time (in ms.) of last event */
  212. extern void       SetTimeSinceLastInputEvent();
  213.  
  214. extern Bool       screenSaved;        /* TRUE if any screen is saved */
  215.  
  216. extern int        spriteCheckInput;
  217. extern void       spriteInputAvail();
  218. extern void       spriteCursorGone();
  219. extern void       spriteBlockHandler();
  220. extern void       spriteWakeupHandler();
  221. #endif _SPRITEDDX_H_
  222.